package com.itbaizhan.escase.document;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient;
import org.springframework.data.elasticsearch.annotations.CompletionField;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.core.suggest.Completion;

@Data
@Document(indexName = "news")  //elasticsearch中文档的索引
public class News {
    @Id
    @Field
    private  Integer id;
    @Field
    private String title;
    @Field
    private String content;
    @Field
    private String url;

    //tag存放的是搜索的关键词，不用打印
    @CompletionField
    @Transient   //忽略json格式，不打印json格式
    private Completion tags;

}
